package com.JavaWeb.service.role;


import com.JavaWeb.dao.BaseDao;
import com.JavaWeb.dao.role.RoleDao;
import com.JavaWeb.dao.role.RoleDaoImpl;
import com.JavaWeb.pojo.Role;

import java.sql.Connection;
import java.util.List;

public class RoleServiceImpl implements RoleService{
        //引入Dao
    private RoleDao roleDao;
    public RoleServiceImpl() {
        roleDao = new RoleDaoImpl();
    }

    public List<Role> getRoleList() throws Exception {
        Connection connection=null;
        List<Role> roleList=null;
        connection = BaseDao.getConnection();
        roleList = roleDao.getRoleList(connection);
       BaseDao.closeResource(connection,null,null);
       return roleList;
    }

//    @Test
//    public void test() throws Exception {
//        RoleServiceImpl roleService = new RoleServiceImpl();
//        List<Role> roleList = roleService.getRoleList();
//            for (Role role:roleList){
//                System.out.println(role.getRoleName());
//            }
//    }
}
